import request from '@/utils/request'

//测试接口

//登录
export const LoginApi = async (data: any) => {
    return await request.post('/users/login', data)
}

//设置页面个人设置修改密码接口
export const emitpostwords = async (data: any) => {
    // console.log(data);
    return await request.post('/users/emit', data)
}

//获取设置页面班级设置表格数据
export const banjidata = async () => {
    return await request.post('/users/class')
}

//设置页面班级设置新增接口
export const addstuses = async (data: any) => {
    // console.log(data)
    return await request.post('/users/addstuse', data)
}

//设置页面班级设置删除接口
export const delbanji = async (id: any) => {
    console.log(id)
    return await request.post('/users/delstuse', { ids: id })
}
//设置页面班级设置设置接口
export const setbanji = async (data: any) => {
    console.log(data)
    return await request.post('/users/setstuse', data)
}

//获取设置页面管理员设置班级管理数据
export const guanbanjidata = async () => {
    return await request.post('/users/guanbanjidatas')
}
//设置页面管理员设置新增接口
export const addguan = async (data: any) => {
    console.log(data)
    return await request.post('/users/addguan', data)
}
//设置页面班级管理删除接口
export const delguan = async (id: any) => {
    console.log(id)
    return await request.post('/users/delguan', { ids: id })
}
//设置页面管理员班级设置
export const gbsz = async (data: any) => {
    // console.log(data)
    return await request.post('/users/gbsz', data)
}
//设置页面管理员教师数据
export const getTeacher = async () => {
    return await request.post('/users/jiaoshidata')
}

//设置页面管理员教师新增
export const addTeacher = async (data: any) => {
    // console.log(data)
    return await request.post('/users/addTeacher', data)
}

//设置页面管理员教师设置接口
export const setTeacher = async (data: any) => {
    // console.log(data)
    return await request.post('/users/setTeacher', data)
}//删除社区乐谱
export const delShareA = async (id: any, type: any) => {
    // console.log(id)
    return await request.post('/users/delShareA', { id, type })
}
//设置页面班级批量删除接口
export const delAll = async (data: any) => {
    // console.log(data)
    return await request.post('/users/delAll', data)
}

//设置页管理员班级管理批量删除

export const delAllguan = async (data: any) => {
    // console.log(data)
    return await request.post('/users/delAllguan', data)
}
//设置页面管理员教师批量删除
export const delAllTeacher = async (data: any) => {
    console.log(data)
    return await request.post('/users/delAllTeacher', data)
}
//设置页面管理员教师删除
export const deljiaoshi = async (id: any) => {
    // console.log(id)
    return await request.post('/users/deljiaoshi', { ids: id })
}


//获取用户信息
export const UserInfoApi = async (author: any) => {
    return await request.get('/users/works', { params: { author } })
}

//分享到个人公开
export const ShareUser = async (data: any) => {
    return await request.post('/users/shareUser', data)
}

//获取个人公开信息
export const getUser = async (id: any) => {
    return await request.get('/users/getUser', { params: { id } })
}


//分享
export const ShareComm = async (data: any) => {
    console.log(data)
    return await request.post('/users/ShareComm', data)
}

//获取社区信息
export const getShareComm = async () => {
    return await request.get('/users/ShareComm')
}

//点赞
export const setAddLike=async(data:any)=>{
    console.log(data)
    return await request.post('/users/addLike',data)
}

//评论
export const setAddComment = async (data: any) => {
    console.log(data)
    return await request.post('/users/addComment', data)
}

//删除评论
export const setDelComment = async (id: any, RwId: any,type:any) => {
    console.log( id,RwId)
    return await request.post('/users/delComment', { id, RwId,type})
} 
// 退出登陆
export const LogoutApi = async () => {
    return await request.get('/users/logout')
}

//获取分组
export const getSelect = async (type:any) => {
    console.log(type)
    return await request.get('/users/ListSelect', { params: { type } })
}

//新建分组
export const addSelect = async (data: any) => {
    console.log(data)
    return await request.post('/users/addListSelect', data)
}

//删除分组
export const delSelect = async (id: any,type:any) => {
    console.log(id,type)
    return await request.post('/users/delListSelect', { id,type })
}

export default {
    // 新建乐谱 添加到编辑区
    addWorks(data: any) {
        return request.post('/users/addList', data)
    },
    // 获取对应数据
    getEditList(id: any, dataId: any) {
        return request.get('/users/editList',
            { params: { id, dataId } }
        )
    },
    // 获取个人信息
    getPresonal(id:any) {
        return request.post(`/users/presonal/${id}`)
    }
} 